package com.ag.admin.action;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.ag.admin.service.aaaaaaaaaaaaaIConfigurationService;
import com.ag.common.BaseAction;
import com.ag.lwc.service.SwitchService;

/**
 * 这里是想要对工程配置的一些设置,
 * 如短信配置
 * @author dgm
 *
 */
@Controller("configurationAction")
public class ConfigurationAction extends BaseAction{

	
	private int messageSwitchInt;//短信的开关,1为开?0为关?
	
	private String result;//返回信息,成功?失败/
	
	@Resource(name = "SwitchService")
	private SwitchService switchService;
	
	/**
	 * 短信控制,开还是关
	 * @return
	 */
	public String messageSwitch(){
		System.out.println("这是messageSwitch方法");
		if(messageSwitchInt==1){			//1则为设为开
			//开短信开关
			switchService.openSwitch(1);	//1代表为表中的短信
			result="开启成功";
		}else if(messageSwitchInt==0){		//0则要设为关
			switchService.closeSwitch(1);	//1代表为表中的短信
			result="关闭成功";
		}
		return "messageSwitch";
	}
	
	public String queryMessage(){
		System.out.println("这是queryMessage方法 ");
		int state = switchService.querySwitchStatus(1);//1代表为表中的短信
		if(state==1){
			result="短信已开";
		}else{
			result = "短信已关";
		}
		return "queryMessage";
	}


	public int getMessageSwitchInt() {
		return messageSwitchInt;
	}


	public void setMessageSwitchInt(int messageSwitchInt) {
		this.messageSwitchInt = messageSwitchInt;
	}


	public String getResult() {
		return result;
	}


	public void setResult(String result) {
		this.result = result;
	}


	public SwitchService getSwitchService() {
		return switchService;
	}

	public void setSwitchService(SwitchService switchService) {
		this.switchService = switchService;
	}
	
	
	
}
